package com.example.design.factory.version6.exercise02;

/**
 * 简单工厂创建反射工厂
 */
public class Factory {

    public  static  Object  forNmae(String classname) throws ClassNotFoundException {
         Object object = null;



        try {
            Class<?> c = Class.forName(classname);
            object=c.newInstance();
        } catch (InstantiationException e) {
            e.printStackTrace();
        } catch (IllegalAccessException e) {
            e.printStackTrace();
        }
        return  object;
    }
}
